import com.rr.RedisDemoApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.concurrent.TimeUnit;

/**
 * @author RR
 * @date 2022/8/15 21:59
 */

@SpringBootTest(classes = RedisDemoApplication.class)
@RunWith(SpringRunner.class)
public class RedisTest1 {
    @Autowired
    private RedissonClient redissonClient;

    @Test
    public void test(){
        RLock s = redissonClient.getLock("s");
        s.lock(1, TimeUnit.MINUTES);

        s.unlock();
    }

}
